<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<jsp:include page="/cnbdw/commons/device.jsp"/>
<script type="text/javascript">
    //页面加载完后响应 onReady
    $(function(){
	    //初始化主列表
	     var cardNum=$("#cardNum").val();
	    $('#bind-datagrid').datagrid({
	        url: '${pageContext.request.contextPath}/employeeAction!bindDeviceDatasource.action?cardNum='+cardNum,
	        border: false,
	        fitColumns: true,
	        height: 200,
	        pagination: false,
	        striped: true,
	        columns: [
	            [
					{field: 'id', checkbox: true},
					{field: 'cardNum', title: '设备名称', align: 'left', formatter: function (value, rowData, rowIndex) {if (value == '') {return '--'} return value;}},
					{field: 'hardwareNo', title: '设备标识', align: 'left', formatter: function (value, rowData, rowIndex) {if (value == '') {return '--'} return value;}},
					{field: 'deviceNo', title: '设备mac', align: 'left', formatter: function (value, rowData, rowIndex) {if (value == '') {return '--'} return value;}},
					{field: 'deviceType', title: '设备类型', align: 'left', 
					   
					    	 formatter: function (value, row, index) {
                    	var html="----"
                    	html = getDeviceTypeName(value);
                        return html;
                    }
					   
					},
					 {field: 'deviceState', title: '设备类型', align: 'left', 
                    formatter: function (value, row, index) {
                    	var html="----"
                    	html = getDeviceStateName(value);
                        return html;
                    }
                },
					{field: 'createTime', title: '创建时间', align: 'left', formatter: function (value, rowData, rowIndex) {if (value == '') {return '--'} return value;}},
					{field: 'createUser', title: '创建人员', align: 'left', formatter: function (value, rowData, rowIndex) {if (value == '') {return '--'} return value;}}
	            ]
	        ]
	    });
	    $('#deviceType').combobox({
	        url:'${pageContext.request.contextPath}/deviceAction!getDeviceTypeSelectData.action',
	        valueField:'id',
	        textField:'name',
	        editable:false
	    });
    });
  //执行查询
    function doQuery() {
	  console.log(serializeObject($('#datasourcequeryform')));
        if ($("#datasource_query_form").form("validate")) {
            $("#bind-datagrid").datagrid('options').queryParams =serializeObject($('#datasourcequeryform')); //把查询条件赋值给datagrid内部变量
            $("#bind-datagrid").datagrid('load'); //重新加载
        }
    }
  //重置查询条件
    function doReset() {
        $('#datasourcequeryform').form('reset');
    }

</script>
<input type="hidden" id="empId" value="${requestScope.empId }" />
<input type="hidden" id="cardNum" value="${requestScope.cardNum }" />
<form id="datasourcequeryform" method="post">
	<table border="0" cellpadding="0" cellspacing="0" height="100%" width="100%">
            <tr>
                <td style="width:10%;text-align:right;" nowrap="nowrap">
                    <label for="datasource_datsourcename">设备名称：</label>
                    <input type="text" id="deviceNo" name="deviceNo" class="easyui-validatebox"
                           data-options="validType:'specialCharFilter'"/>
                </td>
      
                <td style="width:10%;text-align:right;" nowrap="nowrap">
                    <label for="datasource_datsourcename">设备类型：</label>
                    <input type="text" id="deviceType" name="deviceType"
                   		class="easyui-combobox" data-options="validType:'specialCharFilter'"/>
                </td>
                <td style="width:10%;text-align:left;" nowrap="nowrap">
                </td>
                <td colspan="2" style="width:25%;text-align:left;" nowrap="nowrap">
                    <input type="button" onclick="doQuery();" value="查 询" class="search_btn"/>
                    <input type="button" onclick="doReset();" value="重 置" class="reset_btn"/>
                </td>
            </tr>
        </table>
</form>
<table id="bind-datagrid"></table>



